/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package com.gopher.gauth.controller;

import com.gopher.gauth.model.ResponseData;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;


@Controller
@RequestMapping("account")
public class AccountInfoController {

    private static final Logger LOG = LoggerFactory.getLogger(AccountInfoController.class);

    @RequestMapping("/getById")
    @ResponseBody
    public ResponseData getbyId(Model model) {
        LOG.info("execute getbyId方法");
        Map<String,String> data=new HashMap();
        data.put("accountId","123");
        data.put("accountName","lisa");
        return ResponseData.sucess(data);
    }

    @RequestMapping("/list")
    @ResponseBody
    public ResponseData list(Model model) {
        LOG.info("execute list方法");
        Map<String,String> data=new HashMap();
        data.put("accountId","123");
        data.put("accountName","lisa");
        return ResponseData.sucess(data);
    }

    @RequiresPermissions("account_add")
    @RequestMapping("/add")
    @ResponseBody
    public ResponseData add(Model model) {
        LOG.info("execute add方法");

        Map<String,String> data=new HashMap();
        data.put("accountId","123");
        data.put("accountName","lisa");
        return ResponseData.sucess(data);
    }

    @RequiresPermissions("account_update")
    @RequestMapping("/update")
    @ResponseBody
    public ResponseData update(Model model) {
        LOG.info("execute update方法");

        Map<String,String> data=new HashMap();
        data.put("accountId","123");
        data.put("accountName","lisa");
        return ResponseData.sucess(data);
    }

}
